const { mongoose } = require("./db.js")
// 登录信息
const backendUserSchema = mongoose.Schema({
    username: String,
    password: String,
    r_id: String,
})
const backendUserModel = mongoose.model('backendUser', backendUserSchema, 'backendUser');

//角色列表
const roleSchema = mongoose.Schema({
    rolename: String,
    power_id: {
        type: [mongoose.Schema.Types.ObjectId],
        ref: 'power'
    }
})
const roleModel = mongoose.model('role', roleSchema, 'role');

//权限列表
const powerSchema = mongoose.Schema({
    powername: String, // 权限名称
    powerurl: String,  // 权限路径
    powericon: String, // 权限图标
    power_id: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'power'
    }
})
const powerModel = mongoose.model('power', powerSchema, 'power');

module.exports = {
    backendUserModel, roleModel, powerModel
}
